package com.atde._04_structural_design_patterns.decorator.jdk;


import javax.xml.crypto.Data;
import java.io.DataInputStream;
import java.io.IOException;

/**
 * @BelongsProject: hsp_java_design_mode
 * @BelongsPackage: com.atde._04_structural_design_patterns.decorator.jdk
 * @Author: Del
 * @CreateTime: 2025-06-21  16:31
 * @Description: jdk IO流  装饰者模式
 * @Version: 1.0
 */
public class IODecorator {
    public static void main(String[] args) throws IOException {
        /**
         * 说明：
         *  1. InputStream是抽象类，它类似于 Drink
         *  2. FileInputStream是InputStream的子类，它类似于 Decaf
         *  3. FilterInputStream是InputStream的子类，它类似于 Decorator 及修饰者
         *  4. DataInputStream是FilterInputStream的子类，具体的装饰者，类似于 Milk
         *  5. FilterInputStream类 有 protected volatile IputStream in; 即含被装饰者
         *  6. 分析得出在 jdk 的io题型中，就是使用装饰者模式
         */
        DataInputStream dataInputStream = new DataInputStream(System.in);
        System.out.println(dataInputStream.readLine());
        dataInputStream.close();
    }
}
